Skip to content

feat: Code Sync for VS Code extension with cartridge management#382

Merged
clavery merged 2 commits intomainfrom
feature/code-uploader
Apr 25, 2026
Merged

feat: Code Sync for VS Code extension with cartridge management#382
clavery merged 2 commits intomainfrom
feature/code-uploader

Conversation

@clavery
Copy link
Copy Markdown
Collaborator

@clavery clavery commented Apr 25, 2026

Summary

Adds an integrated code upload/sync feature to the VS Code extension, equivalent to b2c code watch and b2c code deploy from the CLI. Includes a cartridge tree view with instance operations and code version management.

SDK changes (@salesforce/b2c-tooling-sdk)

  • uploadFiles() — extracted the batch zip-upload-unzip pipeline from watchCartridges into a standalone reusable function. watchCartridges now calls it internally (no behavior change for CLI users).
  • downloadSingleCartridge() — new function that ZIPs only the target cartridge directory on the server instead of the entire code version. downloadCartridges() now automatically uses this when an include filter is specified, making b2c code download -c cartridge_name significantly faster.
  • autoUpload config field — new boolean in dw.json (autoUpload / auto-upload) for IDE auto-sync default.
  • All changes are additive — no breaking changes to existing APIs.

VS Code extension (b2c-vs-extension)

Code Sync (file watcher):

  • Status bar toggle (icon-only, next to instance selector) with per-instance state persistence via workspaceState
  • Uses VS Code FileSystemWatcher (not chokidar) — picks up external changes (webpack output, terminal commands)
  • Debounced batch upload (150ms) using SDK's uploadFiles
  • Auto-start based on: workspaceState → dw.json autoUpload → off
  • Auto-detects new cartridges via .project file watcher

Cartridge tree view (b2cCartridgeExplorer):

  • Flat list of discovered cartridges with context menu actions:
    • Upload Cartridge — full cartridge upload via WebDAV
    • Download from Instance — per-cartridge download with confirmation (destructive)
    • Upload to Instance — file/folder upload from explorer context menu
    • Add/Remove from Site Cartridge Path — with site picker, position picker, OCAPI→archive import fallback
  • Title bar actions: Deploy, Refresh, Code Versions
  • Code version display in tree view description

Code version management:

  • List versions with activate/reload/delete sub-actions (progress notifications for long operations)
  • Create and activate commands
  • All require OAuth with clear error messages on failure

Deploy command:

  • Cartridge selection QuickPick, post-deploy action (none/activate/reload), progress notification

Other:

  • API Browser moved to separate "B2C-DX: SCAPI" sidebar with $(symbol-interface) icon
  • Graceful degradation without OAuth — all local/WebDAV operations work with basic auth only

…ement

Add file watcher with automatic upload, deploy command, cartridge tree view,
and code version management to the VS Code extension. Extract reusable
uploadFiles and downloadSingleCartridge functions in the SDK for efficient
per-file and per-cartridge operations.

SDK changes:
- Extract batch upload pipeline into uploadFiles() from watchCartridges()
- Add downloadSingleCartridge() for per-cartridge download (ZIPs only the
  target cartridge instead of entire code version)
- downloadCartridges() now uses per-cartridge download when include filter set
- Add autoUpload config field (dw.json: "autoUpload" / "auto-upload")

VS Code extension:
- CodeSyncManager: file watcher using VS Code FileSystemWatcher with debounced
  batch upload, status bar toggle, per-instance state persistence
- Deploy command with cartridge selection and activate/reload options
- Cartridge tree view with discovered cartridges and context menu actions:
  upload, download from instance, add/remove site cartridge path
- Code version management: list, create, activate, reload, delete
- Auto-start based on workspaceState or dw.json autoUpload setting
- Auto-detect new cartridges via .project file watcher
- Move API Browser to separate SCAPI sidebar
@clavery clavery requested a review from wei-liu-sf as a code owner April 25, 2026 02:50
@clavery clavery merged commit 4f30de7 into main Apr 25, 2026
6 checks passed
@clavery clavery deleted the feature/code-uploader branch April 25, 2026 03:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant